//
//  CompleteViewController.m
//  WhatToEat
//
//  Created by Mac on 15/3/20.
//  Copyright (c) 2015年 Mac. All rights reserved.
//

#import "CompleteViewController.h"
#import "PopoverView.h"
#import "ChooseDateViewController.h"

@interface CompleteViewController ()

@end

@implementation CompleteViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self updateUI];
}


-(void)updateUI
{

    //self.view.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg1"]];
 

    
    
 
    UIBarButtonItem *bt=[[UIBarButtonItem alloc] init];
    bt.title=@"返回";
    self.navigationItem.backBarButtonItem=bt;
    


}


- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{

    
    if (textField.tag==1) {
        CGPoint point = CGPointMake(textField.center.x, textField.center.y+100);
        NSArray *titles = @[@"男", @"女"];
        NSArray *images = @[@"boy",@"girl"];
        
        
        
        PopoverView *pop = [[PopoverView alloc] initWithPoint:point titles:titles images:images];
        
        pop.selectRowAtIndex = ^(NSInteger index){
            //    textField.textColor=[UIColor whiteColor];
            textField.text=titles[index];
        };
        [pop show];
        
        return NO;

    }
    
    if (textField.tag==2) {

        ChooseDateViewController *cVC=[self.storyboard instantiateViewControllerWithIdentifier:@"ChooseDateViewController"];
        [self.navigationController pushViewController:cVC animated:YES];
        
        
        
        
        return NO;
        
    }
    
    
    
    
    
   return NO;

}
@end
